.chat-container {
  max-width: 1200px;
  margin: 40px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  padding: 32px 24px 24px 24px;
}

.messages {
  min-height: 600px;
  margin-bottom: 24px;
}

.message {
  display: flex;
  align-items: flex-end;
  margin-bottom: 18px;
  animation: fadeIn 0.4s;
}

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  margin: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #e0e7ef;
  border-radius: 50%;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message-content {
  max-width: 70%;
  background: #f5f7fa;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  font-size: 16px;
  color: #222;
  word-break: break-word;
}

.message.user .message-content {
  background: #dbeafe;
  color: #1e40af;
  align-items: flex-end;
}

.message.assistant .message-content {
  background: #f5f7fa;
  color: #222;
  align-items: flex-start;
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: #888;
}

.input-area {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

input[type="text"] {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 16px;
  background: #f9fafb;
  outline: none;
  transition: border 0.2s;
}

input[type="text"]:focus {
  border: 1.5px solid #2563eb;
}

button[type="submit"] {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 24px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

button[type="submit"]:disabled {
  background: #a5b4fc;
  cursor: not-allowed;
}

/* 等待动画 */
.typing {
  display: flex;
  align-items: center;
  gap: 6px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #2563eb;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.4s infinite both;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px);}
  to { opacity: 1; transform: none;}
}

.im-layout {
  display: flex;
  height: 80vh;
  background: #f3f4f6;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  overflow: hidden;
}

.history-sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.history-item {
  padding: 12px 20px;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.2s, border 0.2s;
  color: #222;
  font-size: 15px;
  border-radius: 0 8px 8px 0;
}

.history-item.active, .history-item:hover {
  background: #e0e7ef;
  border-left: 4px solid #2563eb;
  color: #2563eb;
}

.im-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
}

/* 响应式自适应样式 */
@media (max-width: 900px) {
  .chat-container {
    max-width: 100%;
    margin: 20px 8px;
    padding: 18px 6px 12px 6px;
    border-radius: 10px;
  }
  .message-content {
    max-width: 90%;
    font-size: 15px;
    padding: 10px 12px;
  }
  .avatar {
    min-width: 32px;
    min-height: 32px;
    width: 32px;
    height: 32px;
  }
  .input-area {
    gap: 4px;
    margin-top: 10px;
  }
  input[type="text"] {
    font-size: 15px;
    padding: 8px;
  }
  button[type="submit"] {
    font-size: 15px;
    padding: 0 14px;
  }
}

@media (max-width: 600px) {
  .chat-container {
    max-width: 100vw;
    margin: 0;
    padding: 8px 0 8px 0;
    border-radius: 0;
    box-shadow: none;
  }
  .messages {
    min-height: 300px;
    margin-bottom: 12px;
  }
  .message-content {
    max-width: 98vw;
    font-size: 14px;
    padding: 8px 6px;
    border-radius: 8px;
  }
  .avatar {
    min-width: 26px;
    min-height: 26px;
    width: 26px;
    height: 26px;
    margin: 0 4px;
  }
  .input-area {
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
  }
  input[type="text"] {
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
  }
  button[type="submit"] {
    font-size: 14px;
    padding: 0 8px;
    border-radius: 6px;
    width: 100%;
    margin-top: 4px;
  }
}